package com.idheima.Map.anli;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class Test1 {
    public static void main(String[] args) {
        ArrayList<String> datas = new ArrayList<>(Arrays.asList(
                "13800001111", "13800001111", "13800001112", "13800001113", "13800001114",
                "13800001114", "13800001115", "13800001116", "13800001117", "13800001118",
                "13800001119", "13800001120", "13800001120", "13800001121", "13800001122",
                "13800001123", "13800001124", "13800001125", "13800001126", "13800001127",
                "13800001128", "13800001129", "13800001130", "13800001130", "13800001131",
                "13800001132", "13800001133", "13800001134", "13800001135", "13800001136",
                "13800001137", "13800001138", "13800001139", "13800001140", "13800001141",
                "13800001142", "13800001143", "13800001144", "13800001145", "13800001146",
                "13800001147", "13800001148", "13800001149", "13800001150", "13800001150",
                "13800001151", "13800001152", "13800001153", "13800001154", "13800001155",
                "13800001156", "13800001157", "13800001158", "13800001159", "13800001160",
                "13800001161", "13800001162", "13800001163", "13800001164", "13800001165",
                "13800001166", "13800001167", "13800001168", "13800001169", "13800001170",
                "13800001171", "13800001172", "13800001173", "13800001174", "13800001175",
                "13800001176", "13800001177", "13800001178", "13800001179", "13800001180",
                "13800001181", "13800001182", "13800001183", "13800001184", "13800001185"
        ));
        Map<String, Integer> map = new HashMap<>();

        //2.统计每个景点的投票人数
        for (String data : datas) {
            if (map.containsKey(data)) {
                map.put(data, map.get(data) + 1);
            } else {
                map.put(data, 1);
            }
        }
        map.forEach((k,v)-> System.out.println(k+"="+v));
    }
    }

